
public class Nutrient {
	private float x;
	private float y;
	private boolean alive;
	
	Nutrient() {
		this.x = (float) (Math.random() * Simulation.WORLD_WIDTH);
		this.y = (float) (Math.random() * Simulation.WORLD_HEIGTH);
		this.alive = true;
	}

	public Nutrient(float x, float y) {
		this.x = x;
		this.y = y;
		this.alive = true;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Float.floatToIntBits(x);
		result = prime * result + Float.floatToIntBits(y);
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Nutrient other = (Nutrient) obj;
		if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x)) {
			return false;
		}
		if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) {
			return false;
		}
		return true;
	}

	public float getX() {
		return x;
	}
	
	public float getY() {
		return y;
	}

	public void setAlive(boolean alive) {
		this.alive = alive;
	}
}
